//
//  SNOrderFormReceiverInfoModel.m
//  app
//
//  Created by 王少宁 on 15/5/7.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//  收货人 model

#import "SNOrderFormReceiverInfoModel.h"

@implementation SNOrderFormReceiverInfoModel

- (instancetype)initWithDict:(NSDictionary *)dict expressInfoDic:(NSDictionary *)expressDic storehouse:(NSString *)storehouse
{
    if ([super init]) {
        _nation = dict[@"nation"];
        _province = dict[@"province"];
        _city = dict[@"city"];
        _address = dict[@"address"];
        _district = dict[@"district"];
        _postcode = dict[@"postcode"];
        _phone = dict[@"phone"];
        _receiver = dict[@"receiver"];
        _fullAddress = dict[@"fullAddress"];
        
        _cellHeight = 30;
        
        _cellHeight += [XCommon heightForString:_fullAddress fontSize:13.0f andWidth:SCREEN_WIDTH - UF(48)] + 10;
        
        if (storehouse && storehouse.length) {
            _isStorehouse = YES;
            _storehouse = storehouse;
            _cellHeight += + 30;
        } else {
            _isStorehouse = NO;
        }
        
        if ([expressDic[@"express_sn"] length] == 0) {
            _includeExpressInfo = NO;
        } else {
            _includeExpressInfo = YES;
            _cellHeight += 70;
        }
        
        //物流信息
        _expressInfoModel = [SNOrderFormExpressInfoModel modelWithDict:expressDic];
    }
    return self;
}

+ (instancetype)modelWithDict:(NSDictionary *)dict expressInfoDic:(NSDictionary *)expressDic storehouse:(NSString *)storehouse
{
    return [[self alloc] initWithDict:dict expressInfoDic:expressDic storehouse:storehouse];
}

@end
